

#include<stdio.h>
#include<assert.h>

char* My_strncat(char* dest, const char* src, size_t n)
{
	assert(dest && src);
	char* ret = dest;
	while (*dest)
	{
		dest++;
	}
	while (n--)
	{
		if (*src != '\0')
		{
			*dest = *src;
			dest++;
			src++;
		}
		else
		{
			break;
		}
	}
	*dest = '\0';
	return ret;
}

int main()
{
	char str1[] = "world";
	char str2[30] = "hello xxxxxx";
	My_strncat(str2, str1, 5);
	printf("%s\n", str2);
	return 0;
}